#include"rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
#include "std_msgs/msg/bool.hpp"
using namespace std::chrono_literals;
using std::placeholders::_1;
class node1:public rclcpp::Node{
    public:
    node1():Node("node1"){
        puber1_=this->create_publisher<std_msgs::msg::Bool>("osb",10);
        suber1_=this->create_subscription<std_msgs::msg::String>("oss",10,std::bind(&node1::sub1_callback,this,_1));
    }
    private:
    rclcpp::Publisher<std_msgs::msg::Bool>::SharedPtr puber1_;
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr suber1_;
    void sub1_callback(const std_msgs::msg::String &msg){
        auto message=std_msgs::msg::Bool();
        std::stringstream gk(msg.data);
        int num=0;
        gk>>num;
        message.data=!(num%2);
       puber1_->publish(message);
    }
};
int main(int argc,char* argv[]){
    rclcpp::init(argc,argv);
    rclcpp::spin(std::make_shared<node1>());
    rclcpp::shutdown();
    return 0;

}